﻿using Microsoft.VisualStudio.TestTools.UnitTesting;
using TechTalk.SpecFlow;
using TestProject;

namespace SpecflowTests
{
    [Binding]
    public class StepDefinition1
    {
        private readonly BusinessLayer _businessLayer;

        private int _firstNumber;
        private int _secondNumber;
        private int _result;

        public StepDefinition1()
        {
            _businessLayer = new BusinessLayer();
        }

        [Given("I have entered '(.*)' as first number into the calculator")]
        public void GivenIHaveEnteredSomethingAsFirstNumberIntoTheCalculator(int number)
        {
            _firstNumber = number;
        }

        [Given("I have entered '(.*)' as second number into the calculator")]
        public void GivenIHaveEnteredSomethingAsSecondNumberIntoTheCalculator(int number)
        {
            _secondNumber = number;
        }

        [When("I press add")]
        public void WhenIPressAdd()
        {
            _result = _businessLayer.Add(_firstNumber, _secondNumber);
        }

        [Then("the result should be '(.*)' on the screen")]
        public void ThenTheResultShouldBe(int result)
        {
            Assert.IsTrue(_result == result);
        }
    }
}
